#pragma once

#ifndef _GUIPARTROBOT_H_
#define _GUIPARTROBOT_H_

#include <iostream>
#include "GUIBase.h"
#include "Enums.h"
#include "Part.h"
#include "GUINest.h"
#include "GUIPartRobotInterface.h"
#include "Kit.h"
//#include "PartRobot.h"
#include "PartRobotAgent.h"

class PartRobot;
class GUIPartRobotInterface;
class PartRobotAgent;

#define HOLD_LOC_DIST_FROM_EDGE 19  // The distance from the edge of the bounding box to the spot that holds the part.

enum PartRobotState
{
	Idle,			//Is either Idle at home, or has no orders so is going home

	GoingToPickup,	//Is on the way to pickup parts
	DoingPickup,	//Is ready to pickup parts or is picking up parts

	GoingToDump,	//Is on the way to dump parts
	DoingDumping,	//Is ready to pcikup parts or is picking up parts	


};

//class GUINest;
//class Kit;

/**
 * @class	GUIPartRobot
 *
 * @brief	Graphical user interface part robot.
 *
 * @author	Sean Saleh
 */

class GUIPartRobot : public GUIBase, public GUIPartRobotInterface
{
	public:
		GUIPartRobot(int startx, int starty);

		PartRobotState state;
		bool broken;

		//functions
		void advance(int phase);
		void DoBreak();
		void DoFix();

		//Agent API Calls
		virtual void doPickup(GUINest* targetNestIn, int handNum);
		virtual void doDumpLoad(Kit* kitDestIn);
		void setHost(PartRobot* Host);

	private:
		//functions
		void dumpLoad();
		void pickUp();
		void dropPart();

		//States
		bool doneMoving;
		bool amPickingUp;
		bool startedMoving;

		//Data
		std::vector<Part*> heldParts;
		int currentHand;

		//refrences
		PartRobotAgent *host;
		Kit *kitDest;
		GUINest *targetNest;
		int startX;
		int startY;
};

#endif